package com.tang.server;

import com.tang.codec.ObjDecoder;
import com.tang.codec.ObjEncoder;
import com.tang.domain.MsgInfo;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

/**
 * netty通道初始化
 *
 * @author fulin.tang
 * @version V3.0
 * @since 2021/9/13 12:00
 */
public class MyChannelInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel channel) {
        channel.pipeline().addLast(new ObjEncoder(MsgInfo.class));
        channel.pipeline().addLast(new ObjDecoder(MsgInfo.class));
        channel.pipeline().addLast(new MyServerHandler());
    }

}
